const dotenv = require("dotenv");
const fs = require('fs');
const path = require('path');

dotenv.config();
// 用fs的readFileSync读取私钥和密钥
// path的resolve拼接绝对路径
const PRIVATE_KEY = fs.readFileSync(path.resolve(__dirname,'./keys/private.key'));
const PUBLIC_KEY = fs.readFileSync(path.resolve(__dirname,'./keys/public.key'));

module.exports = {
    APP_HOST, 
    APP_PORT,
    MYSQL_HOST,
    MYSQL_PORT,
    MYSQL_DATABASE,
    MYSQL_USER,
    MYSQL_PASSWORD,
} = process.env;
// 以属性的方式在导出,注意必须放到后面，否则会被覆盖
module.exports.PRIVATE_KEY =PRIVATE_KEY;
module.exports.PUBLIC_KEY =PUBLIC_KEY;